﻿using System;
using System.Collections.Generic;

class sieveOfEratosthenes
{
    static void Main()
    {
        bool[] arrayOfLongs = new bool[10000000];
        for (int index = 2; index < Math.Sqrt(arrayOfLongs.Length); index++)
        {
            if (arrayOfLongs[index] == false)
            {
                for (int i = index*index; i < arrayOfLongs.Length; i = i + index)
                {
                    arrayOfLongs[i] = true;
                }
            }
        }
        for (int j = 2; j < arrayOfLongs.Length; j++)
        {
            if (arrayOfLongs[j] == false)
            {
                Console.Write("{0} ", j);
            }
        }
        Console.WriteLine();
    }
}

